﻿<!--***********************************************************************************

   AvalonDock

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the New BSD
   License (BSD) as published at http://avalondock.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up AvalonDock in Extended WPF Toolkit Plus at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like facebook.com/datagrids

  **********************************************************************************-->

<Window x:Class="AvalonDockTest.Demo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
    xmlns:local="clr-namespace:AvalonDockTest"
    Title="AvalonDock Demo" Closing="Window_Closing" Loaded="Window_Loaded"
        Height="600" Width="800"
        >
  <Window.Resources>
    <local:EmployeeInfoCollection x:Key="EmployeeInfoDataSource"/>
    <!--<ContextMenu
		     x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}"
		     >
            <MenuItem Header="Prova1" 
			Command="ad:DockableContent.FloatingCommand"  />
            <MenuItem Header="Prova2" 
			Command="ad:DockableContent.ShowAsDocumentCommand" />
            <MenuItem Header="Prova3" 
			Command="ad:DockablePane.ToggleAutoHideCommand" />
            <MenuItem Header="Prova4" 
			Command="ad:DockableContent.HideCommand" />
        </ContextMenu>-->

    <!--<Style TargetType="{x:Type ad:DocumentPane}">
            <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ad:DocumentPane}" >
                        <Border 
                        Focusable="False"
                        Background="{TemplateBinding Background}"
                        >
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0">
                                    <Border 
                                    BorderThickness="5" 
                                    BorderBrush="#FFC1D2EE" 
                                    CornerRadius="3" 
                                    Focusable="False">
                                    </Border>
                                    <Border BorderThickness="2" 
                                        BorderBrush="#FFD6E2F8" 
                                        CornerRadius="3" 
                                        Margin="1" 
                                        Focusable="False"
                                        Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}"   
                                        >
                                        <ContentPresenter 
                                        Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}"
                                        Margin="2"
								        KeyboardNavigation.TabNavigation="Local"
								        KeyboardNavigation.DirectionalNavigation="Contained"
								        KeyboardNavigation.TabIndex="1"
                                        />
                                    </Border>
                                </Grid>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="HasItems" Value="False">
                                <Setter Property="Visibility" Value="Hidden"/>
                            </Trigger>
                            <EventTrigger RoutedEvent="Window.Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                        Storyboard.TargetProperty="Opacity"
                                        From="0" To="1"  Duration="0:0:0.200" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>-->


  </Window.Resources>
  <DockPanel LastChildFill="True">
    <DockPanel.LayoutTransform>
      <ScaleTransform ScaleX="1" ScaleY="1"/>
    </DockPanel.LayoutTransform>
    <Menu DockPanel.Dock="Top" >
      <MenuItem Header="File">
        <MenuItem x:Name="ShowDockingManager" Header="Docking Manager Hidden" IsCheckable="True" Click="ShowDockingManager_Checked" />
        <MenuItem Header="Red" Tag="red" Click="ChangeColor_Clicked" />
        <MenuItem Header="Green" Tag="green" Click="ChangeColor_Clicked" />
        <MenuItem Header="Blue" Tag="blue" Click="ChangeColor_Clicked" />
        <MenuItem Header="Gray" Tag="gray" Click="ChangeColor_Clicked" />
        <MenuItem Header="Orange" Tag="orange" Click="ChangeColor_Clicked" />
        <MenuItem Header="Lime" Tag="lime" Click="ChangeColor_Clicked" />
        <MenuItem Header="Magenta" Tag="magenta" Click="ChangeColor_Clicked" />
        <Separator/>
        <MenuItem Header="Reset" Tag="reset" Click="ResetColors_Clicked"/>
      </MenuItem>
    </Menu>
    <ContentControl x:Name="TestContainer">
      <ad:DockingManager x:Name="_dockingManager">
        <ad:ResizingPanel Orientation="Vertical">
          <ad:ResizingPanel Orientation="Horizontal">
            <ad:DockablePane>
              <ad:DockableContent x:Name="_propertiesWindow" Title="Properties" DockableStyle="Dockable" >
                <ad:DockableContent.Icon>
                  <Image Source="Images\display.png" Height="16" Width="16"/>
                </ad:DockableContent.Icon>
                <Border ContextMenu="{StaticResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}">
                  <ListBox Focusable="False"
                                             >
                    <ListBoxItem>ListItem1</ListBoxItem>
                    <ListBoxItem>ListItem2</ListBoxItem>
                    <ListBoxItem>ListItem3</ListBoxItem>
                    <ListBoxItem>ListItem4</ListBoxItem>
                  </ListBox>
                </Border>

              </ad:DockableContent>
						</ad:DockablePane>
            <ad:DocumentPane x:Name="_documentsHost">
              <ad:DocumentContent x:Name="docHome" Title="Home" InfoTip="C:\Program files\Italy\Converters\AvalanDock\AvalonDock.xps  Here your infos..etc.." ContentTypeDescription="XPS document" IsFloatingAllowed="True" Closing="doc_Closing" IsCloseable="False" >
                <FlowDocumentScrollViewer>
                  <FlowDocument FontFamily="Segoue" Background="White">
                    <Paragraph>
                      <Bold>AvalonDock 1.2</Bold>
                    </Paragraph>
                    <Paragraph>
                      Welcome to AvalonDock version 1.2. AvalonDock is a set WPF controls that you can use to enable the Visual Studio environment into your applications.
                    </Paragraph>
                    <Paragraph>
                      AvalonDock is composed of seven controls:
                    </Paragraph>
                    <List>
                      <ListItem>
                        <Paragraph>
                          <Bold>DockingManager</Bold>
                          <LineBreak/>
                          <Run FontSize="12">Represent the docking area of the application. User can move contents between borders of the DockingManager or can arrange them in order to efficiently organize the space available in the window.</Run>
                        </Paragraph>
                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>DockablePane</Bold>
                          <LineBreak/>
                          <Run FontSize="12">This control maintains a list of dockable contents. Usually it organizes them in a tabcontrol-way.</Run>
                        </Paragraph>
                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>DocumentPane</Bold>
                          <LineBreak/>
                          <Run FontSize="12">This control maintains a list of document contents. It's usually the host for application documents that are loaded at runtime. This control always occupies the central part of the DockingManager. DockablePane controls can be only docked to its borders.</Run>
                        </Paragraph>
                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>DockableContent</Bold>
                          <LineBreak/>
                          <Run FontSize="12">Contains the control or collection of controls that can be moved over a DockingManager, docked to a border of it, docked to a border of dockable pane or document pane, or just leaved floating into a created on the fly FloatingWindow.</Run>
                        </Paragraph>
                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>DocumentContent</Bold>
                          <LineBreak/>
                          <Run FontSize="12">Contains a document of the application that is usually created at runtime in response of command of the user. This type of control can be docked only to a border of an DocumentPane.</Run>
                        </Paragraph>
                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>ResizingPanel</Bold>
                          <LineBreak/>
                          <Run FontSize="12">Arrange a series of controls (DockablePane/DocumentPane) in a stacked manner. It has an orientation property which defines how children are managed.</Run>
                        </Paragraph>

                      </ListItem>
                      <ListItem>
                        <Paragraph>
                          <Bold>DocumentPaneResizingPanel</Bold>
                          <LineBreak/>
                          <Run FontSize="12">This control is normally created no the fly by DockingManager and serves as host for DocumentPane. Anyway one can use it to create several DocumentPane at design time.</Run>
                        </Paragraph>

                      </ListItem>

                    </List>

                    <Paragraph>
                      Following list of commands give access to the functionalities of AvalonDock:
                      <LineBreak/>
                      <Hyperlink x:Name="NewDocuments" Click="NewDocuments_Click">Add documents</Hyperlink>
                      <LineBreak/>
                      <Hyperlink x:Name="ShowProperties" Click="ShowProperties_Click">Show properties window</Hyperlink> (
                      <Hyperlink x:Name="ShowProperties_AutoHide" Click="ShowProperties_Click">Autohide</Hyperlink>
                      <Hyperlink x:Name="ShowProperties_FloatingWindow"  Click="ShowProperties_Click">Floating window</Hyperlink> )
                      <LineBreak/>
                      <Hyperlink x:Name="ShowExplorer" Click="ShowExplorer_Click">Show explorer window</Hyperlink> (
                      <Hyperlink x:Name="ShowExplorer_AutoHide" Click="ShowExplorer_Click">Autohide</Hyperlink>
                      <Hyperlink x:Name="ShowExplorer_FloatingWindow"  Click="ShowExplorer_Click">Floating window</Hyperlink> )
                      <LineBreak/>
                      <Hyperlink x:Name="ShowEventsLog" Click="ShowEventsLog_Click">Show events log window</Hyperlink> (
                      <Hyperlink x:Name="ShowEventsLog_AutoHide" Click="ShowEventsLog_Click">Autohide</Hyperlink>
                      <Hyperlink x:Name="ShowEventsLog_FloatingWindow"  Click="ShowEventsLog_Click">Floating window</Hyperlink>
                      <Hyperlink x:Name="ShowEventsLog_DockRight"  Click="ShowEventsLog_Click">Right docked</Hyperlink> )
                      <LineBreak/>
                      <Hyperlink x:Name="ShowProperty" Click="ShowProperty_Click">Show object explorer window</Hyperlink> (
                      <Hyperlink x:Name="ShowProperty_AutoHide" Click="ShowProperty_Click">Autohide</Hyperlink>
                      <Hyperlink x:Name="ShowProperty_FloatingWindow"  Click="ShowProperty_Click">Floating window</Hyperlink>
                      <Hyperlink x:Name="ShowProperty_DockRight"  Click="ShowProperty_Click">Right docked</Hyperlink> )
                      <LineBreak/>
                      <Hyperlink x:Name="SaveLayout" Click="SaveLayout_Click">Save layout</Hyperlink>
                      <Hyperlink x:Name="RestoreLayout"  Click="RestoreLayout_Click">Restore layout</Hyperlink>

                    </Paragraph>
                  </FlowDocument>
                </FlowDocumentScrollViewer>
              </ad:DocumentContent>
            </ad:DocumentPane>
            <ad:DockablePane  Padding="5">
              <ad:DockableContent x:Name="_objectExplorerHost" Title="Object explorer" Padding="5" IsCloseable="False">
                <ad:DockableContent.Icon>
                  <Image Width="16" Height="16" Source="Images\date.png"/>
                </ad:DockableContent.Icon>
              </ad:DockableContent>
            </ad:DockablePane>
          </ad:ResizingPanel>
          <ad:DockablePane  >
            <local:ErrorListContent x:Name="_errorList" Title="ErrorList" HideOnClose="False"  >
              <local:ErrorListContent.Icon>
                <Image Width="16" Height="16" Source="Images\alert.png"/>
              </local:ErrorListContent.Icon>
              <ListView ItemsSource="{Binding Source={StaticResource EmployeeInfoDataSource}}">
                <ListView.View>
                  <GridView AllowsColumnReorder="true"
                                                    ColumnHeaderToolTip="Employee Information">
                    <GridViewColumn DisplayMemberBinding=
                                                  "{Binding Path=FirstName}"
                                              Header="First Name" Width="100"/>
                    <GridViewColumn DisplayMemberBinding=
                                                  "{Binding Path=LastName}"
                                              Header="Last Name" Width="100"/>
                    <GridViewColumn DisplayMemberBinding=
                                                  "{Binding Path=EmployeeNumber}"
                                              Header="Employee No." Width="100"/>
                  </GridView>

                </ListView.View>
              </ListView>
            </local:ErrorListContent>
            <ad:DockableContent x:Name="_eventsLogWindow" Title="Events log">
              <ad:DockableContent.Icon>
                <Image Width="16" Height="16" Source="Images\demo.png"/>
              </ad:DockableContent.Icon>
              <TextBox x:Name="_txtLog" VerticalScrollBarVisibility="Auto" Margin="10" />
            </ad:DockableContent>
            <!--<ad:DockableContent x:Name="_contentDummy" Title="Events log">
							<ad:DockableContent.Icon>
								<Image Width="16" Height="16" Source="Images\demo.png"/>
							</ad:DockableContent.Icon>
							<TextBlock x:Name="_txtLDummy" Margin="10" Text="Content Dummy"/>
						</ad:DockableContent>-->
            <ad:DockableContent x:Name="_explorerWindow" Title="Server Explorer" DockableStyle="DockableToBorders">
              <ad:DockableContent.Icon>
                <Image Width="16" Height="16" Source="Images\database.png"/>
              </ad:DockableContent.Icon>
              <TabControl x:Name="tabControl">
                <TabItem Header="TabItem Header" >
                  <Button x:Name="ButtonDefault" Click="Button_Click">Click me</Button>
                </TabItem>
                <TabItem Header="TabItem Header2" >
                  <StackPanel Orientation="Vertical">
                    <Button x:Name="ButtonDefault2" Click="Button_Click">Click me</Button>
                    <Button x:Name="ButtonDefault3" Click="Button_Click">Click me</Button>
                  </StackPanel>
                </TabItem>
              </TabControl>
            </ad:DockableContent>
          </ad:DockablePane>
        </ad:ResizingPanel>
      </ad:DockingManager>
    </ContentControl>
  </DockPanel>
</Window>
